import { NEWS_SAVE_LIST } from '../action/actionType';

const initialState = {
  // 1. 声明状态，存储数据
  list: [],
};

export default function newsReducer(state = initialState, { type, payload }) {
  switch (type) {
    // 2. 定义保存的逻辑分支
    case NEWS_SAVE_LIST: {
      return { ...state, list: [...payload] };
    }

    default:
      return state;
  }
}
